package cn.edu.scau.daoImpl;

import org.hibernate.Session;
import org.springframework.stereotype.Repository;

import cn.edu.scau.dao.PictureArticleDao;
import cn.edu.scau.entity.PictureArticle;

@Repository("pictrueDaoImpl")
public class PictureArcticleDaoImpl extends BaseDaoImpl<PictureArticle> implements PictureArticleDao {

	/**
	 * 更新数据库中所有图文的栏目id
	 */
	@Override
	public void updateAllColumnID(Integer columnID) {

		// 编写hql语句
		String hqlColumn = "update PictureArticle pa set ColumnID = :newColnmnID";
		// 获得session
		Session session = getSessionFactory().openSession();
		// 执行操作
		session.createQuery(hqlColumn).setInteger("newColnmnID", columnID).executeUpdate();
		// flush到数据库
		session.flush();
		// 关闭session
		session.close();

	}

}
